home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / CODE / Chap11 / MyWord / MyWord.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  1.2 KB  |  50 lines

  1. //***********************************************************************
  2. //
  3. //  MyWord.cpp
  4. //
  5. //***********************************************************************
  6.  
  7. #include <afxwin.h>
  8. #include <afxext.h>
  9. #include <afxcmn.h>
  10. #include <afxrich.h>
  11. #include "Resource.h"
  12. #include "MyWord.h"
  13. #include "StyleBar.h"
  14. #include "MainFrame.h"
  15. #include "MyWordDoc.h"
  16. #include "MyWordView.h"
  17.  
  18. CWordApp myApp;
  19.  
  20. BEGIN_MESSAGE_MAP (CWordApp, CWinApp)
  21.     ON_COMMAND (ID_FILE_NEW, CWinApp::OnFileNew)
  22.     ON_COMMAND (ID_FILE_OPEN, CWinApp::OnFileOpen)
  23. END_MESSAGE_MAP ()
  24.  
  25. BOOL CWordApp::InitInstance ()
  26. {
  27.     SetRegistryKey ("Programming Windows 95 with MFC");
  28.     LoadStdProfileSettings ();
  29.  
  30.     CSingleDocTemplate* pDocTemplate;
  31.     pDocTemplate = new CSingleDocTemplate (
  32.         IDR_MAINFRAME,
  33.         RUNTIME_CLASS (CWordDoc),
  34.         RUNTIME_CLASS (CMainFrame),
  35.         RUNTIME_CLASS (CWordView)
  36.     );
  37.  
  38.     AddDocTemplate (pDocTemplate);
  39.     RegisterShellFileTypes (TRUE);
  40.  
  41.     CCommandLineInfo cmdInfo;
  42.     ParseCommandLine (cmdInfo);
  43.  
  44.     if (!ProcessShellCommand (cmdInfo))
  45.         return FALSE;
  46.  
  47.     m_pMainWnd->DragAcceptFiles ();
  48.     return TRUE;
  49. }
  50.